<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@include file="/common/common.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

</head>
<body>
		<div class="container-fluid">
		<div class="row" style="height:800px">
			<div class="col-lg-2" style="background:#737373;height:800px">
				<div id="tree"></div>
			</div>
		    <div class="col-lg-9" style="height:800px">
		    	<!-- addtabs的导航栏 -->
		    	<ul class="nav nav-tabs" id="myTab"></ul>
		    	<!-- addtabs的内容 -->
		    	<div class="tab-content"></div>
		    </div>
		</div>
	</div>
	<script type="text/javascript">
			function getTree() {
				var tree = [];
					$.ajax({
						url:"/permissionsController/getTSource",
						data:{},
						type:"post",
						async:false,//同步
						dataType:"json",
						success:function(data){
							tree = data;
						},
						error:function(){
							msg("系统错误，请联系管理员",3000);
						}
					})
				return tree;
					}
		$('#tree').treeview({
			data: getTree(),
			//backColor:"red", 所有节点的背景颜色
			borderColor:"gray",//树的边框
			//checkedIcon:"glyphicon glyphicon-heart",
			//showCheckbox:true,//是否在节点前面加复选框
			collapseIcon:"glyphicon glyphicon-star-empty",
			emptyIcon:"glyphicon glyphicon-star-empty",
			expandIcon:"glyphicon glyphicon-star",
			onNodeSelected:function(event, data){

				if(data.nodes == undefined ){
					$.addtabs.add({
						id:data.id,
						title:data.text,
						url:"<%=path%>"+data.url
					})
				}
			}
			});
</script>
</body>
</html>